#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 1e5+10;
int a[maxn];
int main()
{
	int n;
	int num1 = 0;
	int num2 = 0;
	int num3 = 0;
	int num4 = 0;
	int ans = 0;
	scanf("%d",&n);
	for(int i = 0;i<n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]==1) num1++;
		else if(a[i]==2) num2++;
		else if(a[i]==3) num3++;
		else num4++;
	}
	ans += num3+num4;
	if(num1-num3<0) num1 = 0;
	else num1 = num1-num3;
	if(!(num1%2))num1 = num1/2;
	else num1 = (num1+1)/2;
	ans += (num1+num2)/2;
	if((num1+num2)%2) ans++;
	printf("%d\n",ans);
}
